from datetime import datetime, timezone, timedelta

import jwt


def generate_jwt(useruuid,username,platform):
    # 生成token
    payload = {
        'useruuid': useruuid,
        'username': username,
        'platform': platform,
        'exp': datetime.now(timezone.utc) + timedelta(seconds=3600*12)
    }
    jwtdata = jwt.encode(payload, key = 'private_key', algorithm='HS256')
    return jwtdata


